export default {
  // 获取token
  getToken: (...args) => uni.$request.post("/public/getToken", ...args),
  // 微信小程序绑定手机号
  bindMobileByWeiXin: (...args) => uni.$request.post("/public/bindMobileByWeiXin", ...args),
  // 授权登录
  loginByOAuth2: (...args) => uni.$request.post("/public/loginByOAuth2", ...args),
  // 发送验证码
  sendSms: (...args) => uni.$request.post("/public/sendSms", ...args),
  // 登录
  mobileLogin: (...args) => uni.$request.post("/public/mobileLogin", ...args),
  // 错误日志提交
  addSystemErrorLog: (...args) => uni.$request.post("/public/addSystemErrorLog", ...args),
  // 微信JS-SDK初始化
  wxJsApiInit: (...args) => uni.$request.post("/public/wxJsApiInit", ...args),
  // 云闪付SDK初始化
  ysfJsApiInit: (...args) => uni.$request.post("/public/upsdkJsApiInit", ...args),
  // 工行SDK初始化
  icbcJsApiInit: (...args) => uni.$request.post("/public/icbcJsApiInit", ...args),
  // 翼支付SDK初始化
  yzfJsApiInit: (...args) => uni.$request.post("/public/bestpayUserAuth", ...args),
  // 获取位置信息
  getLocation: (...args) => {
    return new Promise((resolve, reject) => {
      uni.$request
        .get("https://map.zmaxfilm.com", ...args)
        .then((res) => {
          if (res.status == "OK") {
            resolve({
              cityCode: res.result.addressComponent.cityCode?.slice(-6),
              cityName: res.result.addressComponent.city,
              areaName: res.result.addressComponent.district,
              provinceName: res.result.addressComponent.province,
              address: res.result.formattedAddress,
              latitude: res.result.location.lat,
              longitude: res.result.location.lng
            })
          } else {
            reject(res)
          }
        })
        .catch((err) => {
          reject(err)
        })
    })
  }
}
